import re
import time
from tornado import gen
from tornado_mysql import pools

pools.DEBUG = True

pool = pools.Pool(
    dict(host='localhost', port=3306, user='user', passwd='password', db='db_name', charset='utf8'),
    max_idle_connections=1,
    max_recycle_sec=3,
)


class TestModel:

    @classmethod
    @gen.coroutine
    def test(cls) -> bool:
        cursor = yield pool.execute("select 1")
        data = cursor.fetchall()
        if len(data) != 0:
            return True
        else:
            return False
